# -*- coding:utf-8 -*-

def digital_root(nu):
    if len(nu) == 1:
        return nu
    else:
        result = '0'
        for index in range(len(nu)):
            result = str(int(result) + int(nu[index]))
        return digital_root(result)

digital_root('123456')